<template>
  <el-container class="h-full ">
    <el-aside width="260px" class="bg-sidebar col-f">
    </el-aside>
    <el-container>
      <el-main>
        <el-page-header @back="$router.push('/site')" content="gpt"></el-page-header>
        <div class=""></div>
      </el-main>
      <el-footer>
          <div class="w-full">
            <el-input placeholder="请输入内容" v-model="text" class="input-with-select">
              <el-button slot="append" icon="el-icon-search" @keydown.enter="completion" @click.native="completion"></el-button>
            </el-input>
          </div>
      </el-footer>
    </el-container>
  </el-container>
</template>

<script>
import ChatGpt from "api/learn/ChatGpt";
export default {
  name: "gptMain" ,
  data(){
    return {
      text: '' ,
      selectVal: 5 ,
      historyLog: [] ,
      fromData:{} ,
    }
  },
  created() {

  },
  methods:{
    submit(){
      console.log(this.selectVal)
    },
    completion(){
      ChatGpt.completion(this.text).then(res=>{
        console.log(res)
      })
    },
    dialogue(){
      ChatGpt.dialogue(this.text).then(res=>{
        console.log(res)
      })
    }
  },
  computed:{
    courseFormData(){
      return [
        {
          key: 'dirId',
          type: 'select' ,
          title: '课程类别',
          required: true ,
          props:{
            url: '/dir/list',
            method: 'get' ,
            map:{
              label: 'dirName' ,
              value: 'id'
            }
          }
        },
        {
          key: 'bookName' ,
          title: '书本名称',
          required: true ,
        },
        {
          key: 'cover' ,
          title: '书本封面',
          required: false ,
        },
        {
          key: 'sort' ,
          title: '排序',
          required: false ,
          type:"number"
        },
        {
          key: 'desc' ,
          title: '书本描述',
          type: "textarea"
        }
      ]
    }
  }
}
</script>

<style scoped>

</style>
